/*  Reflection.java
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.liang.agile.enumerate;

import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Set;
import java.util.TreeSet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Reflection {
    private static final Logger LOGGER = LoggerFactory.getLogger(Reflection.class);

    public Set<String> analyze(Class<?> enumClass) {
        LOGGER.info("------- Analyzing {} -------", new Object[] {enumClass});
        LOGGER.info("interfaces:");
        for (Type type : enumClass.getGenericInterfaces()) {
            LOGGER.info(type.toString());
        }
        LOGGER.info("Base {}", new Object[] {enumClass.getSuperclass()});
        LOGGER.info("Methods ");
        Set<String> methods = new TreeSet<String>();
        for (Method method : enumClass.getMethods()) {
            methods.add(method.getName());
        }
        LOGGER.info("{}", new Object[] {methods});
        return methods;
    }
}
